/////////////////////////////////////////////////////////////////////        
// Reg.h: interface for the CReg class.
//
//Version:
//    1.0.0
//Date:
//    2007.04.07
//////////////////////////////////////////////////////////////////////

#ifndef REG_H
#define REG_H 



class CReg  
{
public:
	BOOL DeleteKey(LPCTSTR szName);
	BOOL DeleteValue(LPCTSTR szName);
	BOOL SetMultiSZ(LPCTSTR szName, LPCTSTR lpszValue, DWORD dwLen);
	BOOL SetBinary(LPCTSTR szName, LPBYTE lpbValue, DWORD dwLen);
	BOOL SetDW(LPCTSTR szName, DWORD dwValue);
	BOOL SetSZ(LPCTSTR szName, LPCTSTR szValue);
	BOOL SetSZ(LPCTSTR szName, LPCTSTR szValue, DWORD dwLen);
	DWORD GetValueDW(LPCTSTR szName, DWORD dwDefault=0);
	LPCTSTR GetValueSZ(LPCTSTR szName);
	LPBYTE GetValueBinary(LPCTSTR szName);
	DWORD GetValueBinary(LPCTSTR szName, LPBYTE lpbValue, DWORD dwLen);
	BOOL GetValueSZ(LPCTSTR szName, LPTSTR szValue, DWORD dwLen);
	BOOL EnumValue(LPTSTR pszName, DWORD dwLenName, LPTSTR pszValue, DWORD dwLenValue);
	BOOL EnumKey(LPTSTR psz, DWORD dwLen);
	BOOL IsOK();
	operator HKEY();
	void Reset();
	CReg(HKEY hkRoot, LPCTSTR pszKey);
	BOOL Open(HKEY hkRoot, LPCTSTR pszKey, REGSAM sam=KEY_READ);
	BOOL Create(HKEY hkRoot, LPCTSTR pszKey);
	CReg();
	virtual ~CReg();

private:
	HKEY    m_hKey;
	int        m_Index;
	LPBYTE    m_lpbValue; // last value read, if any
};

#endif //#ifndef REG_H
